package com.events;

import com.bricks2break.Statics;

public abstract class Event {
	private float endTime;

	/**
	 * Constructor
	 * @param duration	the duration of the event
	 */
	public Event(float duration) {
		endTime = Statics.eventTimer.getTime() + duration;
	}

	/**
	 * Check if the time has exceeded the end time of the event
	 * @param time - the current time(since the level started)
	 */
	public void checkEndTime(float time) {
		if (time > endTime) {
			endEvent();
			Statics.eventTimer.removeEvent(this);
		}
	}

	/**
	 * Abstract method that reverts the effect of the event
	 */
	public abstract void endEvent();
}
